package ooday03;



public class Test {
    public static void main(String[] args) {
        Dog dog=new Dog("小黄",3,"黄色");
        System.out.println(dog.name);

         Dog[] dogs=new Dog[3];
         dogs[0]=new Dog("小黑",2,"黑色");
         dogs[1]=new Dog("小花",1,"黑白");
//        dogs[1]=null;
         dogs[2]=new Dog("小白",3,"白色");
        System.out.println(dogs[0].name);
        dogs[1].age=4;
        dogs[2].swim();
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }


         Chick[] chicks=new Chick[2];
         chicks[0]=new Chick("小黄",2,"黄色");
         chicks[1]=new Chick("草鸡",1,"白色");

         Fish[] fish=new Fish[3];
         fish[0]=new Fish("贝贝",1,"金色");
         fish[1]=new Fish("晶晶",1,"红色");
         fish[2]=new Fish("缓缓",2,"黑色");
         for (int i=0;i<dogs.length;i++){
             System.out.println(dogs[i].name);
             System.out.println(dogs[i].age);
             dogs[i].lookHome();
         }
         for (int i=0;i<chicks.length;i++) {

             System.out.println(chicks[i].name);
             System.out.println(chicks[i].color);
             chicks[i].layEggs();
         }
         for (int i=0;i<fish.length;i++) {

             System.out.println(fish[i].name);
             System.out.println(fish[i].age);
             fish[i].eat();
         }

    }
}
